﻿using System;
using System.Collections.Generic;
using System.Data;
using System.Data.Entity;
using System.Linq;
using System.Web;
using System.Web.Mvc;
using Website.Models;
using Business.DAO;
using System.Collections;
using Business.Models;

namespace Website.Controllers
{ 
    public class NienHocController : Controller
    {
        NienHocDAO dao = new NienHocDAO();
        NienHocModel model = null;
        // GET: /NienHoc/

        public ViewResult Index(int id)
        {
            model = new NienHocModel(); 
            model._NienHoc = dao.GetByTruongHoc(id);
            model._TreeView = GetTreeView();

            return View(model); 
        }

        private TreeViewModel GetTreeView()
        {
            TreeViewModel treeView = new TreeViewModel();
            treeView._TruongHoc = new TruongHocDAO().GetAll();
            treeView._NienHoc = new NienHocDAO().GetAll();
            treeView._LopHoc = new LopHocDAO().GetAll();
            return treeView;
        }

    }
}